<?php


namespace part16_StateMode\Code4;

/**
 * 下午工作状态
 */
class AfternoonState extends State
{

    public function writeProgram($work)
    {
        if ($work->getHour() < 18) {
            echo "当前时间：{$work->getHour()} 点 下午状态还不错，继续努力\n";
        } else {
            // 超过18点，转入晚间工作状态
            $work->setState(new EveningState());
            $work->writeProgram();
        }
    }
}